<p>You are given two strings, <code>str1</code> and <code>str2</code>, of lengths <code>n</code> and <code>m</code>, respectively.</p>

<p>A string <code>word</code> of length <code>n + m - 1</code> is defined to be <strong>generated</strong> by <code>str1</code> and <code>str2</code> if it satisfies the following conditions for <strong>each</strong> index <code>0 &lt;= i &lt;= n - 1</code>:</p>

<ul>
	<li>If <code>str1[i] == &#39;T&#39;</code>, the <strong><span data-keyword="substring-nonempty">substring</span></strong> of <code>word</code> with size <code>m</code> starting at index <code>i</code> is <strong>equal</strong> to <code>str2</code>, i.e., <code>word[i..(i + m - 1)] == str2</code>.</li>
	<li>If <code>str1[i] == &#39;F&#39;</code>, the <strong><span data-keyword="substring-nonempty">substring</span></strong> of <code>word</code> with size <code>m</code> starting at index <code>i</code> is <strong>not equal</strong> to <code>str2</code>, i.e., <code>word[i..(i + m - 1)] != str2</code>.</li>
</ul>

<p>Return the <strong><span data-keyword="lexicographically-smaller-string">lexicographically smallest</span></strong> possible string that can be <strong>generated</strong> by <code>str1</code> and <code>str2</code>. If no string can be generated, return an empty string <code>&quot;&quot;</code>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">str1 = &quot;TFTF&quot;, str2 = &quot;ab&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">&quot;ababa&quot;</span></p>

<p><strong>Explanation:</strong></p>

<h4>The table below represents the string <code>&quot;ababa&quot;</code></h4>

<table>
	<tbody>
		<tr>
			<th style="border: 1px solid black;">Index</th>
			<th style="border: 1px solid black;">T/F</th>
			<th style="border: 1px solid black;">Substring of length <code>m</code></th>
		</tr>
		<tr>
			<td style="border: 1px solid black;">0</td>
			<td style="border: 1px solid black;"><code>&#39;T&#39;</code></td>
			<td style="border: 1px solid black;">&quot;ab&quot;</td>
		</tr>
		<tr>
			<td style="border: 1px solid black;">1</td>
			<td style="border: 1px solid black;"><code>&#39;F&#39;</code></td>
			<td style="border: 1px solid black;">&quot;ba&quot;</td>
		</tr>
		<tr>
			<td style="border: 1px solid black;">2</td>
			<td style="border: 1px solid black;"><code>&#39;T&#39;</code></td>
			<td style="border: 1px solid black;">&quot;ab&quot;</td>
		</tr>
		<tr>
			<td style="border: 1px solid black;">3</td>
			<td style="border: 1px solid black;"><code>&#39;F&#39;</code></td>
			<td style="border: 1px solid black;">&quot;ba&quot;</td>
		</tr>
	</tbody>
</table>

<p>The strings <code>&quot;ababa&quot;</code> and <code>&quot;ababb&quot;</code> can be generated by <code>str1</code> and <code>str2</code>.</p>

<p>Return <code>&quot;ababa&quot;</code> since it is the lexicographically smaller string.</p>
</div>

<p><strong class="example">Example 2:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">str1 = &quot;TFTF&quot;, str2 = &quot;abc&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">&quot;&quot;</span></p>

<p><strong>Explanation:</strong></p>

<p>No string that satisfies the conditions can be generated.</p>
</div>

<p><strong class="example">Example 3:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">str1 = &quot;F&quot;, str2 = &quot;d&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">&quot;a&quot;</span></p>
</div>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= n == str1.length &lt;= 10<sup>4</sup></code></li>
	<li><code>1 &lt;= m == str2.length &lt;= 500</code></li>
	<li><code>str1</code> consists only of <code>&#39;T&#39;</code> or <code>&#39;F&#39;</code>.</li>
	<li><code>str2</code> consists only of lowercase English characters.</li>
</ul>
